﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CuitWinDateTimePicker.cs" company="">
//   
// </copyright>
// <summary>
//   The cuit win date time picker.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace UITest.CUIT.CuitControls.WinControls
{
    using System;
    using System.Windows.Forms;

    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;

    /// <summary>
    ///     The cuit win date time picker.
    /// </summary>
    public class CuitWinDateTimePicker : CuitWinControl<WinDateTimePicker>
    {
        #region Constructors and Destructors

        /// <summary>
        ///     Initializes a new instance of the <see cref="CuitWinDateTimePicker" /> class.
        /// </summary>
        public CuitWinDateTimePicker()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitWinDateTimePicker"/> class.
        /// </summary>
        /// <param name="testControl">
        /// The test control.
        /// </param>
        public CuitWinDateTimePicker(UITestControl testControl)
            : base(testControl)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitWinDateTimePicker"/> class.
        /// </summary>
        /// <param name="testControl">
        /// The test control.
        /// </param>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        public CuitWinDateTimePicker(UITestControl testControl, string searchProperties)
            : base(testControl, searchProperties)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitWinDateTimePicker"/> class.
        /// </summary>
        /// <param name="testControl">
        /// The test control.
        /// </param>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        /// <param name="filterProperties">
        /// The filter properties.
        /// </param>
        public CuitWinDateTimePicker(UITestControl testControl, string searchProperties, string filterProperties)
            : base(testControl, searchProperties, filterProperties)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitWinDateTimePicker"/> class.
        /// </summary>
        /// <param name="wrappedControl">
        /// The wrapped control.
        /// </param>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        public CuitWinDateTimePicker(ICuitControlBase wrappedControl, string searchProperties)
            : base(wrappedControl, searchProperties)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitWinDateTimePicker"/> class.
        /// </summary>
        /// <param name="wrappedControl">
        /// The wrapped control.
        /// </param>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        /// <param name="filterProperties">
        /// The filter properties.
        /// </param>
        public CuitWinDateTimePicker(ICuitControlBase wrappedControl, string searchProperties, string filterProperties)
            : base(wrappedControl, searchProperties, filterProperties)
        {
        }

        #endregion

        #region Public Properties

        /// <summary>
        ///     Gets the calendar.
        /// </summary>
        public UITestControl Calendar
        {
            get
            {
                this._control.WaitForControlReady();
                return this._control.Calendar;
            }
        }

        /// <summary>
        ///     Gets or sets the date time.
        /// </summary>
        public DateTime DateTime
        {
            get
            {
                this._control.WaitForControlReady();
                return this._control.DateTime;
            }

            set
            {
                this._control.WaitForControlReady();
                this.WriteTestOutput(value.ToString());
                this._control.DateTime = value;
            }
        }

        /// <summary>
        ///     Gets or sets the date time as string.
        /// </summary>
        public string DateTimeAsString
        {
            get
            {
                this._control.WaitForControlReady();
                return this._control.DateTimeAsString;
            }

            set
            {
                this._control.WaitForControlReady();
                this.WriteTestOutput(value);
                this._control.DateTimeAsString = value;
            }
        }

        /// <summary>
        ///     Gets the format.
        /// </summary>
        public DateTimePickerFormat Format
        {
            get
            {
                this._control.WaitForControlReady();
                return this._control.Format;
            }
        }

        /// <summary>
        ///     Gets a value indicating whether has check box.
        /// </summary>
        public bool HasCheckBox
        {
            get
            {
                this._control.WaitForControlReady();
                return this._control.HasCheckBox;
            }
        }

        /// <summary>
        ///     Gets a value indicating whether has drop down button.
        /// </summary>
        public bool HasDropDownButton
        {
            get
            {
                this._control.WaitForControlReady();
                return this._control.HasDropDownButton;
            }
        }

        /// <summary>
        ///     Gets a value indicating whether has spinner.
        /// </summary>
        public bool HasSpinner
        {
            get
            {
                this._control.WaitForControlReady();
                return this._control.HasSpinner;
            }
        }

        /// <summary>
        ///     Gets or sets a value indicating whether show calendar.
        /// </summary>
        public bool ShowCalendar
        {
            get
            {
                this._control.WaitForControlReady();
                return this._control.ShowCalendar;
            }

            set
            {
                this._control.WaitForControlReady();
                this.WriteTestOutput(value.ToString());
                this._control.ShowCalendar = value;
            }
        }

        #endregion
    }
}